// Created from GenerationTemplate
// For Decisions HL7 Engine
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Reflection;
using DecisionsFramework.Design.Properties;
using Decisions.HL7.Generated.AbstractMessage;
using Decisions.HL7.DataTypes;
using ST = System.String;
using SI = System.String;
using TX = System.String;
using FT = System.String;
using IS = System.String;
using ID = System.String;
using SNM = System.String;

namespace Decisions.HL7.Message
{
    [DataContract]
	public class CN : AbstractDataType
    {

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("1 ID number (ST)",1)]
  	    [HL7Field(HL7Version.v23, 1, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 1, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 1, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST IDnumberST {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("2 family name",2)]
  	    [HL7Field(HL7Version.v23, 2, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 2, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 2, HL7Repeat.False, HL7Required.True,"FN")]
	    public FN familyname {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("3 given name",3)]
  	    [HL7Field(HL7Version.v23, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 3, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 3, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST givenname {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("4 Middle Name Or Initial",4)]
  	    [HL7Field(HL7Version.v23, 4, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 4, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 4, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST MiddleNameOrInitial {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("5 suffix (e.g., JR or III)",5)]
  	    [HL7Field(HL7Version.v23, 5, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 5, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 5, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST suffixegJRorIII {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("6 prefix (e.g., DR)",6)]
  	    [HL7Field(HL7Version.v23, 6, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 6, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 6, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST prefixegDR {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("7 degree (e.g., MD)",7)]
  	    [HL7Field(HL7Version.v23, 7, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 7, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v24, 7, HL7Repeat.False, HL7Required.True,"IS")]
	    public IS degreeegMD {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("8 source table",8)]
  	    [HL7Field(HL7Version.v23, 8, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v231, 8, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v24, 8, HL7Repeat.False, HL7Required.True,"IS")]
	    public IS sourcetable {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("9 assigning authority",9)]
  	    [HL7Field(HL7Version.v23, 9, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v231, 9, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v24, 9, HL7Repeat.False, HL7Required.True,"HD")]
	    public HD assigningauthority {get;set;}





		public override string GetER7(HL7ParserOptions options) {
			List<string> dataTypeParts = new List<string>();
		    dataTypeParts.Add(IDnumberST);
			dataTypeParts.Add(GetER7TextForDataPart(familyname, options));
		    dataTypeParts.Add(givenname);
		    dataTypeParts.Add(MiddleNameOrInitial);
		    dataTypeParts.Add(suffixegJRorIII);
		    dataTypeParts.Add(prefixegDR);
		    dataTypeParts.Add(degreeegMD);
		    dataTypeParts.Add(sourcetable);
			dataTypeParts.Add(GetER7TextForDataPart(assigningauthority, options));
			return CleanUpTrailingComponentSeps(string.Join("" + options.ComponentSep, dataTypeParts.ToArray()), options);
		}
    }
}

